package nial.sms.parking;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

import android.widget.ArrayAdapter;
import android.widget.Spinner;


public class ParkingActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Spinner spinnerCities = (Spinner) findViewById(R.id.spinnerCities);
        ArrayAdapter<CharSequence> adapterCities = ArrayAdapter.createFromResource(
                this, R.array.arrayCities, android.R.layout.simple_spinner_item);
        adapterCities.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        //spinnerCities.setOnItemSelectedListener(new SpinnerCitiesOnItemSelectedListener());
        spinnerCities.setAdapter(adapterCities);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.settingsmenu, menu);
        return true;
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
            case R.id.menuSettings:
            	  startActivity(new Intent(ParkingActivity.this, 
                          SettingsActivity.class));

                return true;
            case R.id.menuExit:
            	int pid = android.os.Process.myPid();
                android.os.Process.killProcess(pid);
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
/*
	public class SpinnerZonesOnItemSelectedListener implements
			OnItemSelectedListener {

		public void onItemSelected(AdapterView<?> parent, View view, int pos,
				long id) {
			Toast.makeText(parent.getContext(),
					"Selected " + parent.getItemAtPosition(pos).toString(),
					Toast.LENGTH_LONG).show();

		}

		public void onNothingSelected(AdapterView parent) {
			// Do nothing.
		}
	}

	public class SpinnerCitiesOnItemSelectedListener implements
			OnItemSelectedListener {

		public void onItemSelected(AdapterView<?> parent, View view, int pos,
				long id) {
			Toast.makeText(
					parent.getContext(),
					"City changed to : "
							+ parent.getItemAtPosition(pos).toString(),
					Toast.LENGTH_LONG).show();

		}

		public void onNothingSelected(AdapterView parent) {
			// Do nothing.
		}
	}
*/
}
